<template>
  <div class="table-page">
    <el-pagination
      @current-change="handleCurrentChange"
      :current-page.sync="value.current"
      :page-size="value.size"
      layout="prev, pager, next, jumper"
      :total="value.total">
    </el-pagination>
  </div>
</template>

<script type="text/ECMAScript-6">
  /**
   * @author 白雨浓
   * @date 2018/5/10 15:08
   *
   * 分页
   **/
  export default {
    name: 'Page',
    props: ['value', 'scrollTo'],
    data() {
      return {}
    },
    watch: {},
    mounted() {
      this.$nextTick(() => {

      })
    },
    methods: {
      /** 页码改变处理 */
      handleCurrentChange(current) {
        if (this.scrollTo)
          window.scrollTo(this.scrollTo[0], this.scrollTo[1]);
        else
          window.scrollTo(0, 0);
        this.$emit('input', this.value);
        this.$emit('change', current);
      }
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
  .table-page {
    display flex
    justify-content center
    align-items center
    width 100%
    height 80px
    text-align center
  }
</style>
